#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project : gtmsAutoTestProject 
@File    : print_device_list_interface.py
@IDE     : PyCharm 
@Author  : Mario
@Date    : 2022/5/6 17:35 
@Describe: 打印机列表接口
"""
from fastapi import APIRouter
from FastApi.dto.baseResponseDto import BaseResponseDtoModel
from FastApi.server.middle.setup.printer.print_device_list_server import print_device_list
from FastApi.dto.middle.setupDto.printer.print_device_list_dto import PrintDeviceListDtoModel
from Comm.logUtils.logControl import LogHandler

logger = LogHandler().get_logger()
printDeviceList_router = APIRouter()
response_model = BaseResponseDtoModel()


@printDeviceList_router.post("/device/list", name="打印机列表")
async def printDeviceList(payload: PrintDeviceListDtoModel):
    logger.info('请求参数:[{}]'.format(payload))
    print_device_data = print_device_list(payload.environment, payload.brandCode)
    response_model.return_dict['data'] = print_device_data
    logger.info('接口响应:[{}]'.format(response_model.return_dict))
    return response_model.return_dict
